﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Suppliers.aspx.cs" Inherits="Suppliers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Supplier</title>

    <script language="JavaScript" src="js/CalendarPopup.js"></script>

    <script language="JavaScript">
        var cal = new CalendarPopup();
    </script>

    <style type="text/css">
        .style2
        {
            width: 361px;
        }
        .style3
        {
            width: 15%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table border="0" cellpadding="1" cellspacing="1" width="100%">
        <tr>
            <td width="15%" >
                Supplier:
            </td>
            <td>
                <asp:TextBox ID="txtSupplierId" runat="server" Enabled="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style3">
                Company Name:
            </td>
            <td class="style2">
                <asp:TextBox ID="txtCompanyName" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvCompanyName" runat="server" ErrorMessage="Please input !"
                    ControlToValidate="txtCompanyName"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style3">
                Contact Name:
            </td>
            <td class="style2">
                <asp:TextBox ID="txtContactName" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvContactName" runat="server" ControlToValidate="txtContactName"
                    ErrorMessage="Please input!"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style3">
                Contact Title:
            </td>
            <td class="style2">
                <asp:TextBox ID="txtContactTitle" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvContactTitle" runat="server" ControlToValidate="txtContactTitle"
                    ErrorMessage="Please input!"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style3">
                Address:
            </td>
            <td class="style2">
                <asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvAddress" runat="server" ControlToValidate="txtAddress"
                    ErrorMessage="Please input!"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style3">
                City
            </td>
            <td class="style2">
                <asp:TextBox ID="txtCity" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvCity" runat="server" ControlToValidate="txtCity"
                    ErrorMessage="Please input!"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style3">
                Region:
            </td>
            <td class="style2">
                <asp:TextBox ID="txtRegion" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style3">
                Postal Code:
            </td>
            <td class="style2">
                <asp:TextBox ID="txtPostalCode" runat="server"></asp:TextBox>
                <asp:RangeValidator ID="rgPostalCode" runat="server" ControlToValidate="txtPostalCode"
                    ErrorMessage="Wrong input!" MaximumValue="99999" MinimumValue="10000" 
                    Type="Integer"></asp:RangeValidator>
            </td>
        </tr>
        <tr>
            <td class="style3">
                Country:
            </td>
            <td class="style2">
                <asp:DropDownList ID="ddlCountry" runat="server" Height="16px" Width="135px">
                    <asp:ListItem>Brazil</asp:ListItem>
                    <asp:ListItem>Finland</asp:ListItem>
                    <asp:ListItem>USA</asp:ListItem>
                    <asp:ListItem>Italy</asp:ListItem>
                    <asp:ListItem>Germany</asp:ListItem>
                    <asp:ListItem>Mexico</asp:ListItem>
                    <asp:ListItem>Argentina</asp:ListItem>
                    <asp:ListItem>Switzerland</asp:ListItem>
                    <asp:ListItem>Sweden</asp:ListItem>
                    <asp:ListItem>Austria</asp:ListItem>
                    <asp:ListItem>UK</asp:ListItem>
                    <asp:ListItem>Poland</asp:ListItem>
                    <asp:ListItem>Canada</asp:ListItem>
                    <asp:ListItem>Ireland</asp:ListItem>
                    <asp:ListItem>France</asp:ListItem>
                    <asp:ListItem>Norway</asp:ListItem>
                    <asp:ListItem>Venezuela</asp:ListItem>
                    <asp:ListItem>Belgium</asp:ListItem>
                    <asp:ListItem>Spain</asp:ListItem>
                    <asp:ListItem>Denmark</asp:ListItem>
                    <asp:ListItem>Portugal</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style3">
                Phone:
            </td>
            <td class="style2">
                <asp:TextBox ID="txtPhone" runat="server"></asp:TextBox>
                <asp:RegularExpressionValidator ID="revPhonr" runat="server" ControlToValidate="txtPhone"
                    ErrorMessage="Wrong input!" 
                    ValidationExpression="\(?\d?\d?\d?\)?\ *\d\d\d\-?\ ?\d\d\d\d\d*"></asp:RegularExpressionValidator>
                <asp:RequiredFieldValidator ID="rfvPhone" runat="server" ControlToValidate="txtPhone"
                    ErrorMessage="Please input!"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style3">
                Fax:
            </td>
            <td class="style2">
                <asp:TextBox ID="txtFax" runat="server"></asp:TextBox>
                <asp:RegularExpressionValidator ID="revFax" runat="server" ControlToValidate="txtFax"
                    ErrorMessage="Wrong input!" 
                    ValidationExpression="\(?\d?\d?\d?\)?\ *\d\d\d\-?\ ?\d\d\d\d\d*"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <table>
            <tr>
                <td>
                    <asp:Button ID="btnNew" runat="server" Text="New" OnClick="btnNew_Click" CausesValidation="False"
                        Width="80px" />
                    <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" Width="80px" />
                    <asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_Click"
                        Width="80px" />
                    <asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="btnDelete_Click"
                        CausesValidation="False" Width="80px" />
                    <asp:Button ID="btnReload" runat="server" Text="Reload" OnClick="btnReload_Click"
                        CausesValidation="False" Width="80px" />
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <asp:TextBox ID="txtSearch" runat="server" Width="200px"></asp:TextBox>
                <asp:DropDownList ID="ddlSearchBy" runat="server" Width="121px">
                    <asp:ListItem>Company Name</asp:ListItem>
                    <asp:ListItem>Contact Name</asp:ListItem>
                </asp:DropDownList>
                <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click"
                    CausesValidation="False" Width="80px"></asp:Button>
            </tr>
        </table>
        <asp:GridView ID="gvSuppliers" runat="server" OnPageIndexChanging="gvSupplier_PageIndexChanging"
            OnSelectedIndexChanged="gvSuppliers_SelectedIndexChanged" AutoGenerateColumns="False">
            <Columns>
                <asp:BoundField DataField="supplierid" HeaderText="Supplier ID" />
                <asp:BoundField DataField="companyname" HeaderText="Company Name" />
                <asp:BoundField DataField="contactname" HeaderText="Contact Name" />
                <asp:BoundField DataField="contacttitle" HeaderText="Contact Title" />
                <asp:BoundField DataField="address" HeaderText="Address" />
                <asp:BoundField DataField="city" HeaderText="City" />
                <asp:BoundField DataField="region" HeaderText="Region" />
                <asp:BoundField DataField="postalcode" HeaderText="Postal Code" />
                <asp:BoundField DataField="country" HeaderText="Country" />
                <asp:BoundField DataField="phone" HeaderText="Phone" />
                <asp:BoundField DataField="fax" HeaderText="Fax" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="sqlDatasource1" runat="server"></asp:SqlDataSource>
</asp:Content>
